classdef DataPartition < BatHandle & RandomSeedable
    
    properties ( SetAccess = protected )
        type = 'k_fold'; % {'k_fold', 'hold_out'}
        nRep = 1 % Number of repetitions
        nFld = 5 % Number of folds
        nSubFld = 3 % Number of sub-folds
        zzSeenId = {} % Seen data partition index matrices
                        % Including training and validation data partition 
                        % index
                        % 1-by-nRep cell
        zzUnsnId = {} % Unseen data partition index matrices
                        % Including test data partition index
                        % 1-by-nRep cell
        zzTrnId = {} % Training data partition index matrices
        zzValId = {} % Validation data partition index matrices
        zzTstId = {} % Test data partition index matrices
    end
    
    properties ( SetAccess = protected, Dependent = true )
    end
    
    methods % Construct
        function [ this ] = DataPartition( name, type, nRep, nFld, nSubFld, obj )
            if nargin == 0
                this.setName('dp');
            end
            if nargin >= 1
                this.setName(name);
            end
            if nargin == 2
                error('BatErr: Invalid input arguments.');
            end
            if nargin == 3
                error('BatErr: Invalid input arguments.');
            end
            if nargin == 4
                error('BatErr: Invalid input arguments.');
            end
            if nargin >= 5
                this.setType(type);
                this.setNRep(nRep);
                this.setNFld(nFld);
                this.setNSubFld(nSubFld);
            end
            if nargin >= 6
                % Shuffle automatically
                this.shuffle(obj);
            end
        end
    end
    
    methods ( Hidden = true )
        [  ] = setZzSeenIdMat( this, zzIdMat )
        [  ] = setZzUnsnIdMat( this, zzIdMat )
        [  ] = setZzTrnIdMat( this, zzIdMat )
        [  ] = setZzValIdMat( this, zzIdMat )
        [  ] = setZzTstIdMat( this, zzIdMat )
    end
    
end
